package com.itheima05;

import java.util.ArrayList;
import java.util.stream.Stream;

public class StreamTest {
    public static void main(String[] args) {
        ArrayList<String> manList = new ArrayList<String>();

        manList.add("周润发");
        manList.add("成龙");
        manList.add("刘德华");
        manList.add("吴京");
        manList.add("周星驰");
        manList.add("李连杰");

        ArrayList<String> womanList = new ArrayList<String>();
        womanList.add("林心如");
        womanList.add("张曼玉");
        womanList.add("林青霞");
        womanList.add("柳岩");
        womanList.add("林志林");
        womanList.add("王祖贤");

        // 男演员只要前三个的三个字
        Stream<String> manStream = manList.stream().limit(3).filter(s -> s.length() == 3);

        // 女演员不要第一个，姓林的
        Stream<String> womanStream = womanList.stream().skip(1).filter(s -> s.startsWith("林"));

        // 把过滤后的男女演员合并到一起
        Stream<String> concatStream = Stream.concat(manStream, womanStream);

        // 遍历合并好的流
//        concatStream.map(s -> new Actor(s)).forEach(System.out::println);
        concatStream.map(Actor::new).forEach(System.out::println);

    }
}
